package com.sm.tool.entity.request;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.DecimalMax;
import javax.validation.constraints.DecimalMin;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;

@Data
@ApiModel
public class AddTicketsRequest {

    @NotNull
    @Length(min = 4, max = 20, message = "ticket_name 4-20位")
    @ApiModelProperty(value = "优惠卷名称",example ="中秋好礼券" ,required = true)
    private String ticketName;

    @ApiModelProperty(value = "优惠卷code(只能事数字加英文的组合)" +
            "，注意 注册有礼券必须是:25yu1ss6xx6666t",example ="qk2sz3445454ds",hidden = true,required = false)
    @Pattern(regexp="^\\w+$",message = "优惠卷code(只能事数字加英文的组合)")
    private String ticketCode;

    @NotNull
    @DecimalMax("2")
    @DecimalMin("0")
    @ApiModelProperty(value = "0:满减券,1:折扣券,2:立减券",example ="0",required = true )
    private int type;

    @DecimalMax("1000")
    @DecimalMin("0")
    @ApiModelProperty(value = "券发送数量",example ="100",required = true)
    private int number;


    @DecimalMax("1")
    @DecimalMin("0")
    @ApiModelProperty(value = "能使用该券的用户类型. 0:不限制,1新用户(默认为0)",example ="1",required = true)
    private int useUserType;

    @Range(min = 1,max = 99,message = "最多领取张数不能大于100张")
    @ApiModelProperty(value = "每人最多领取多少张",example ="10",required = true)
    private int  maxReceive;

    @Range(min = 1,max = 999,message = "最多领取张数不能大于100张")
    @ApiModelProperty(value = "有效期，30,表示领取30后过期。0表示不限制",example ="30",required = false)
    private int  termOfValidity;


    @ApiModelProperty(value = "满减券策略，50,20,表示满50减20",example ="50,20",required = false)
    @Length(min = 4, max = 8, message = "满减券策略，只能是xx,xx格式")
    private String fullRed;

    @ApiModelProperty(value = "折扣卷策略，8表示8折",example ="8",required = false)
    @DecimalMax("9.9")
    @DecimalMin("1")
    private Double discount;

    @ApiModelProperty(value = "立减卷策略，20表示减20",example ="20",required = false)
    private Integer verticalReduction;


    @ApiModelProperty(value = "使用说明",example ="XXXXX",required = true)
    private String  explains;


}
